﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace Poly2Tri
{
	// Token: 0x0200040C RID: 1036
	public struct FixedArray3<T> : IEnumerable<T>, IEnumerable where T : class
	{
		// Token: 0x17000425 RID: 1061
		public T this[int index]
		{
			get
			{
				switch (index)
				{
				case 0:
					return this._0;
				case 1:
					return this._1;
				case 2:
					return this._2;
				default:
					throw new IndexOutOfRangeException();
				}
			}
			set
			{
				switch (index)
				{
				case 0:
					this._0 = value;
					break;
				case 1:
					this._1 = value;
					break;
				case 2:
					this._2 = value;
					break;
				default:
					throw new IndexOutOfRangeException();
				}
			}
		}

		// Token: 0x06001CE9 RID: 7401 RVA: 0x000B3FEC File Offset: 0x000B21EC
		public bool Contains(T value)
		{
			for (int i = 0; i < 3; i++)
			{
				if (this[i] != null)
				{
					T t = this[i];
					if (t.Equals(value))
					{
						return true;
					}
				}
			}
			return false;
		}

		// Token: 0x06001CEA RID: 7402 RVA: 0x000B4040 File Offset: 0x000B2240
		public int IndexOf(T value)
		{
			for (int i = 0; i < 3; i++)
			{
				if (this[i] != null)
				{
					T t = this[i];
					if (t.Equals(value))
					{
						return i;
					}
				}
			}
			return -1;
		}

		// Token: 0x06001CEB RID: 7403 RVA: 0x000B4094 File Offset: 0x000B2294
		public void Clear()
		{
			this._0 = (this._1 = (this._2 = (T)((object)null)));
		}

		// Token: 0x06001CEC RID: 7404 RVA: 0x000B40C0 File Offset: 0x000B22C0
		public void Clear(T value)
		{
			for (int i = 0; i < 3; i++)
			{
				if (this[i] != null)
				{
					T t = this[i];
					if (t.Equals(value))
					{
						this[i] = (T)((object)null);
					}
				}
			}
		}

		// Token: 0x06001CED RID: 7405 RVA: 0x000B4120 File Offset: 0x000B2320
		private IEnumerable<T> Enumerate()
		{
			for (int i = 0; i < 3; i++)
			{
				yield return this[i];
			}
			yield break;
		}

		// Token: 0x06001CEE RID: 7406 RVA: 0x000B4148 File Offset: 0x000B2348
		public IEnumerator<T> GetEnumerator()
		{
			return this.Enumerate().GetEnumerator();
		}

		// Token: 0x06001CEF RID: 7407 RVA: 0x000B4155 File Offset: 0x000B2355
		IEnumerator IEnumerable.GetEnumerator()
		{
			return this.GetEnumerator();
		}

		// Token: 0x04001DB0 RID: 7600
		public T _0;

		// Token: 0x04001DB1 RID: 7601
		public T _1;

		// Token: 0x04001DB2 RID: 7602
		public T _2;
	}
}
